﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using ServiceStack.Text;

namespace Monitor.Models.JsonModel
{
    public class AreaInfo
    {
        public long AreaId { get; set; }
        public string AreaTitle { get; set; }
        public string AreaCoords { get; set; }
        public string AreaComment { get; set; }
        public string AreaCarsId { get; set; }

        public AreaInfo(){}
        public AreaInfo(Repository.UserRepository.LinqModel.Area queryModelArea)
        {
            AreaId = queryModelArea.AreaId;
            AreaTitle = queryModelArea.FullName;
            AreaCoords = queryModelArea.Coords;
            AreaComment = "Комент";
            AreaCarsId = queryModelArea.Cars.Select(m => m.CarId).ToJson();
        }
    }
}